/**
 * Created by thinkl on 2017/6/23.
 */
$(function () {
    var app_data = {
        commodity: [],
        cart_change: [],
        order_id: 0,
    };
    var app = new Vue({
        el: '#shopping_cart',
        data: app_data,
        methods: {
            go_address_list: function () {
                var cart_change = {cart_ids: app_data.cart_change.toString()};
                $.post('/order/create_order', cart_change, function (data) {
                        var res = JSON.parse(data);
                        if (res.success) {
                            location.href = '/static/order_detail/order_detail.html?order_id=' + res.result.id;
                        }
                    }
                );
            }
        }
    });
    $.post('/shopping_cart/query_shopping_cart', {}, function (data) {
        var l = JSON.parse(data);
        app_data.commodity = l.result;
    });

});
